-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Don't warn about v128
in wasm ABI transition
#139809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @compiler-errors. Use |
Like with #139498, I'm going to beta-nominate this as the affected warning is currently present on beta. |
Hi @alexcrichton, could you elaborate on what you mean by "other warning if necessary"? Based on the reported code snippet in #138762 (comment) but with #![allow(wasm_c_abi)]
use std::arch::wasm32::{
v128,
v128_any_true};
#[no_mangle]
pub fn any_true(a: v128) -> bool {
v128_any_true(a)
} I'm not observing another warning, am I missing something? Or rather, could you slightly elaborate on why |
Oh sure yeah, this code: use std::arch::wasm32::*;
#[unsafe(no_mangle)]
#[target_feature(enable = "simd128")]
pub extern "C" fn foo(_: v128) {}
This PR is just addressing the second one which shows up transitively through crates, not the first one which I'm not changing here. |
Thanks, that's what I was missing |
6925ce1
to
38667e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@bors r+ rollup |
improper_ctypes warns about so many things that are needed in practice and generally work fine, chances are people have it allowed... but I guess then they don't get to complain if we change the ABI.^^ |
I suppose we can call this out in relnotes? |
Unsettled discussion on trade-offs |
We have a blogpost about the transition, and the relnotes (I expect) will link there. So there are other ways people can learn about this. But, also note that improper_ctypes is not an FCW so unlike this warning, it will not show up for dependencies. If my dependency passes |
Sorry I'm a bit confused, what's being asked for here? The |
I'm slightly concerned some crate could be passing Can you point at the declaration of such an intrinsic that causes a warning? Why would an intrinsic use the "C" ABI? Usually they do not. |
The intrinsics that get the warning are LLVM intrinsics, not Rust intrinsics, which stdarch declares as |
r? RalfJung (since you have concerns) |
☔ The latest upstream changes (presumably #139992) made this pull request unmergeable. Please resolve the merge conflicts. |
This has other warnings if necessary and doesn't need extra warnings from this FCW. cc rust-lang#138762
38667e5
to
53a5900
Compare
Is there a specific reason for this? Most (all?) other targets use |
@RalfJung the warning this PR is fixing is showing up on beta/nightly right now and ideally something should be landed/backported to fix both channels. It sounds like you're concerned about correcting the source of truth for these intrinsics and warning as many people as possible about the usage of simd types in the C ABI on wasm, and while I sympathize with that I feel like it's orthogonal to the purpose of this PR, to fix the warning that should not be firing. In terms of backporting I suspect a more focused change such as this would be more amenable to backporting than updating the stdarch submodule which has the risk of bringing in other unrelated changes too. I agree if it works it's probably best to use "unadjusted" as the ABI for wasm intrinsics in this situation, but I also don't think such work should block this PR and fixing the warning on beta. |
I'm only in favor of landing this PR if it is actually correct that the ABI of this SIMD type is the same under the old and new ABI. My understanding is that that is not the case.
We can of course land a temporary hack, but that should be clearly documented as such.
@Amanieu what are your thoughts regarding the proper way to fix these warning that originate from compiler-builtins?
I am a bit confused since I would expect that if the SIMD ABI changes in this transition, then we'd see SIMD intrinsics break when setting the -Z flag that enables the new ABI.
|
Ah never mind, the compiler-builtins PR has landed. Any chance we could get a release so we can check whether that fixes the underlying issue here? |
I believe that simd types get special handling. Here's a comparison showing the ABI being the same. I'm under the impression this PR is not a "temporary hack" but it's a fix of a false positive of the transition warning firing. |
Ah, if the ABI is the same then that is a good argument for not showing the warning. :) The PR description makes a different argument though, which is why I didn't realize this. Could you update the PR description and the comment in the code to refer to the fact that vectors are indeed unaffected by the transition? |
Sure, updated |
// If this is a simd argument let other rustc warnings kick in and don't | ||
// provide extra warnings here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If this is a simd argument let other rustc warnings kick in and don't | |
// provide extra warnings here | |
// SIMD types are passed the same way under both ABIs. |
// The `v128` is already warned as not-FFI-safe by the | ||
// `improper_ctypes_definitions` lint, so no need to doubly warn about it with | ||
// the `wasm_c_abi` lint. Test for the lint from `improper_ctypes_definitions` | ||
// but this doubly asserts that there are no other lints, such as from the | ||
// `wasm_c_abi` lint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment also needs updating.
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
The
-Zwasm-c-abi=spec
mode ofextern "C"
does not actually change the meaning ofv128
meaning that the FCW lint firing is a false positive.cc #138762 (comment)